import { request } from "~~/utils/fetch";
import { reponseIntercept } from "@/utils";
import { http } from "../utils/http";

// 查询用户 BDC 持有价值趋势图
export const getTendencyChart = (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/account/tendencyChart",
    method: "post",
    body: data,
  });

// 分页查询用户BDC收支明细
export const getChangeRecord = (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/account/changeRecord/page",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 积分兑换成BDC
export const integralExchangeToBdc = (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/account/integralExchangeToBdc",
    method: "post",
    body: data,
  });

// 获取文章列表
export const getArticleList = (data: any) =>
  request({
    url: "/article",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 获取文章详情
export const getArticleDetail = async (data: any) =>
  request({
    url: "/article-detail",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 获取 Banner 列表
export const getBannerList = http.Post("/bannerV2");

// BDC持有量TOP100
export const getLeaderboard = http.Post(
  "/msa/traded-api-bdc/top/aco/leaderboard"
);

// BDC持有量TOP100 v2 后端加了缓存
export const getLeaderboardV2 = http.Post(
  "/msa/traded-api-bdc/top/aco/leaderboardV2"
);

// 分页查询商品列表
export const getListShopGoods = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/shop/goods/listShopGoods",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 兑换商品
export const getPurchaseShopGoods = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/shop/goods/purchaseShopGoods",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 分页查询兑换商品记录
export const getShopGoodsRecord = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/shop/goods/pageShopGoodsRecord",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 分页查询宝箱列表
export const getBoxList = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/box/list",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 查询挖矿信息
export const getBoxmineInfo = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/box/mineInfo",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 宝箱-开箱
export const openBox = async (data: any, call: any) =>
  request({
    url: "/msa/api-activity/bdc/user/box/open",
    method: "post",
    body: data,
  }).then((e) => reponseIntercept(e, call));

// 宝箱-开箱
export const openBoxAll = async (data: any, call: any) =>
  request({
    url: "/msa/api-activity/bdc/user/box/openBatch",
    method: "post",
    body: data,
  }).then((e) => reponseIntercept(e, call));

// 挖矿达人
export const getMinerExpert = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/top/minerExpert",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 查询挖矿任务奖励
export const getTaskRewardList = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/common/task/taskRewardList",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 查询挖矿动态
export const getRecentActivity = http.Post(
  "/msa/traded-api-bdc/box/aco/recentActivity"
);

// 查询coin页面参与人数
export const getThemePeopleJoinCount = async (data: any) =>
  request({
    url: "/bbs/themePeopleJoinCount",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 查询 累计挖矿人数
export const getCumulativeAcquireInfo = async (data: any) =>
  request({
    url: "/msa/api-activity/bdc/user/account/cumulativeAcquireInfo",
    method: "post",
    body: data,
  }).then(reponseIntercept);

// 查询tabbar 红点 信息
export const getRewardInfo = http.Post(
  "/msa/traded-api-bdc/common/acr/queryRewardInfo"
);

// 查询渠道页的任务列表
export const getTaskList = http.Post(
  "/msa/api-activity/task-center-v3/btc/task/list"
);

/**
 * @description: BDC Mining 明细
 */
export const getDetailMing = http.Post(
  "/msa/traded-api-bdc/box/acr/taskRecord/page"
);
